package com.haocang.szgm.ui.event.adapter;

import android.content.Context;

import com.haocang.szgm.R;
import com.haocang.szgm.ui.event.bean.EventBean;
import com.haocang.commonlib.recyclerView.BaseAdapter;
import com.haocang.commonlib.recyclerView.BaseViewHolder;
import com.haocang.szgm.utils.tools.MyTextUtils;
import com.haocang.szgm.utils.tools.OptionsItemsUtils;

/**
 * 创建时间：2019/3/5
 * 编 写 人：ShenC
 * 功能描述：
 */

public class EventListAdapter extends BaseAdapter<EventBean> {

    public EventListAdapter(Context context) {
        super(context, R.layout.item_event_list);
    }

    @Override
    public void convert(BaseViewHolder holder, EventBean bean) {

        if(bean.getStatus() == 0){
            holder.setText(R.id.item_status,"未处理")
                    .setBackgroundResource(R.id.item_status,R.drawable.bt_red_01);
        }else if(bean.getStatus() == 1){
            holder.setText(R.id.item_status,"处理中")
                    .setBackgroundResource(R.id.item_status,R.drawable.bt_orange_01);
        }else if(bean.getStatus() == 2){
            holder.setText(R.id.item_status,"已处理")
                    .setBackgroundResource(R.id.item_status,R.drawable.bt_green_01);
        }

        holder.setText(R.id.item_1, MyTextUtils.GetOpitemValue(OptionsItemsUtils.GetEventType(),1,bean.getTypeID())  +"  [等级:"+MyTextUtils.GetOpitemValue(OptionsItemsUtils.GetEventLevel(),1,bean.getLevel()+"")+"]" )
                .setText(R.id.item_2, bean.getMemo())
                .setText(R.id.item_3, MyTextUtils.toYMDHM(bean.getCreateDT()))
                .setText(R.id.item_4, bean.getProcessortorName());
        holder.addOnClickListener(R.id.item_lin);
    }

}